package com.hongyue.dey02;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

public class Demo {
    public static void main(String[] args) throws IOException {
        DatagramSocket ds = new DatagramSocket();
        String a = "你好啊";
        String aa = feiQiu(a);
        byte[] gbks = aa.getBytes("gbk");
        InetAddress byName = InetAddress.getByName("192.168.67.51");
        DatagramPacket p = new DatagramPacket(gbks, 0, gbks.length, byName, 2425);
        ds.send(p);
        ds.close();
    }

    private static String feiQiu(String a) {
        StringBuffer sb = new StringBuffer();
        sb.append("1:");
        sb.append(System.currentTimeMillis() + ":");
        sb.append("feikr:");
        sb.append("110.110.110.110:");
        sb.append("32:");
        sb.append(a);
        return sb + "";

    }
}
